<template>
   <el-dialog   :visible.sync="visible" :title="title"  width="750px"  :before-close="handleClose"  @opened="handleOpen">

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="deviceList">
      <el-table-column label="科室/部门" align="center" prop="useofficename" />
      <el-table-column label="良好设备数" align="center" prop="normalnum" />
       <el-table-column label="故障设备数" align="center" prop="faultnum" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </el-dialog>
</template>

<script>
import { selectDeviceTj } from "@/api/zyx/device";

export default {
  name: "deviceTjList",
  components: {
  },
  data() {
    return {
      memberid:null,
      visible: false,
      title:'提示',
      // 遮罩层
      loading: true,

      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 设备基础信息表格数据
      deviceList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  created() {
	this.loading = false;
  },
  methods: {

    handleOpen(){
      this.getList();
    },
  /** 查询设备基础信息列表 */
      getList() {
        this.loading = true;
        selectDeviceTj(this.queryParams).then(response => {
          this.deviceList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        departid: null,
        devicecode: null,
        devicetype: null,
        useoffice: null,
        deptname:null,

      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeInstalldate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleClose(done) {
      done();
      },
  }
};
</script>
